package com.glodon.paas.document.dao.mysql;

import org.springframework.beans.factory.annotation.Autowired;

import com.glodon.paas.document.dao.LockDao;
import com.glodon.paas.document.dao.domain.LockEntity;
import com.glodon.paas.document.dao.mapper.LockEntityMapper;

public class LockDaoMysqlImpl implements LockDao {

    @Autowired
    private LockEntityMapper lockEntityMapper;

    @Override
    public String insert(LockEntity entity) {
        lockEntityMapper.insert(entity);
        return entity.getId();
    }

    @Override
    public LockEntity get(String id) {
        return lockEntityMapper.selectByPrimaryKey(id);
    }

    @Override
    public int delete(String id) {
        return lockEntityMapper.deleteByPrimaryKey(id);
    }

    public void setLockEntityMapper(LockEntityMapper lockEntityMapper) {
        this.lockEntityMapper = lockEntityMapper;
    }
}
